home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / misc / edu / globe099src.lha / Ami-Globe / test_flag.c < prev    next >
C/C++ Source or Header  |  1994-05-24  |  3KB  |  124 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3. #include <libraries/dos.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <fcntl.h>
  9. #include <ctype.h>
  10. #include <exec/types.h>
  11. #include <intuition/intuition.h>
  12. #include <intuition/intuitionbase.h>
  13. #include <graphics/gfx.h>
  14. #include <graphics/gfxmacros.h>
  15. #include <graphics/gfxbase.h>
  16. #include <proto/exec.h>
  17. #include <proto/dos.h>
  18. #include <proto/intuition.h>
  19. #include <proto/graphics.h>
  20.  
  21. #include "amiglobe_types.h"
  22. #include "flag_protos.h"
  23.  
  24. WORD ColorMap[] =
  25. {
  26.     0x0000,0x0fff,0x0f00,0x00f0,0x000f,0x0444,0x0555,0x0655,
  27.     0x0733,0x0E00,0x0A90,0x0888,0x0050,0x0DDD,0x0FE0,0x0FFF
  28. };
  29.  
  30. struct    TmpRas    tmpras;        /* Pour les areadraw */
  31. struct    AreaInfo myareainfo;
  32.  
  33. #define WIDTH    640
  34. #define HEIGHT    480
  35.  
  36. #define    BUFFER_SIZE    80
  37.  
  38. int    *P_Tab_Drapeau;
  39.  
  40. WORD    areabuffer[MAX_AREA_PT];
  41.  
  42. main(int argc,char **argv)
  43. {
  44.  
  45.     struct    Screen    *s;
  46.     struct    Window    *win;
  47.     struct    TmpRas    tmpras;
  48.     struct    RastPort    *rp;
  49.     int    oldx,oldy;
  50.     int    Flg_Exit;
  51.     CLIP    My_Clip;
  52.     char    *p_name;
  53.  
  54.     if(argc<=1){
  55.         p_name="test_token";
  56.     }else{
  57.         p_name=argv[1];
  58.     }
  59.     if(Flag_Read(p_name,&P_Tab_Drapeau)){
  60.         My_Clip.minx=10;
  61.         My_Clip.maxx=300;
  62.         My_Clip.miny=10;
  63.         My_Clip.maxy=250;
  64.     
  65.         s = OpenScreenTags (NULL,
  66.               SA_Depth, (ULONG) 5,
  67.               SA_ShowTitle, FALSE,
  68.               SA_Quiet, TRUE,
  69.               TAG_DONE);
  70.         if(s){
  71.             LoadRGB4(&s->ViewPort,ColorMap,32);
  72.             win=OpenWindowTags(
  73.                 NULL,
  74.                 WA_Left,    0,
  75.                 WA_Top,        0,
  76.                 WA_Width,    s->Width,
  77.                 WA_Height,    s->Height,
  78.                 WA_CustomScreen,s,
  79.                 WA_IDCMP,    IDCMP_CLOSEWINDOW|IDCMP_MOUSEMOVE,
  80.                 WA_Flags,    WFLG_SIMPLE_REFRESH|WFLG_CLOSEGADGET|WFLG_ACTIVATE|WFLG_REPORTMOUSE,
  81.                 TAG_DONE);
  82.  
  83.             if(win){
  84.                 rp=win->RPort;
  85.                 InitArea(&myareainfo,areabuffer,MAX_AREA_PT);
  86.                 rp->AreaInfo=&myareainfo;
  87.                 rp->TmpRas=(struct TmpRas *)InitTmpRas(&tmpras,AllocRaster(WIDTH,HEIGHT),RASSIZE(WIDTH,HEIGHT));
  88.     
  89.     
  90.                 oldx=100;
  91.                 oldy=100;
  92.                 Flg_Exit=FALSE;
  93.     
  94.                 Flag_Draw(rp,&My_Clip,P_Tab_Drapeau,s->ViewPort.ColorMap);
  95.     
  96.                 while(Flg_Exit==FALSE){
  97.                     struct    IntuiMessage *msg;
  98.                     int    class,code;
  99.         
  100.                     WaitPort(win->UserPort);
  101.                     while((msg=(struct IntuiMessage *)GetMsg(win->UserPort))!=0){
  102.                         class=msg->Class;
  103.                         code=msg->Code;
  104.                         ReplyMsg((struct Message *)msg);
  105.                         switch(class){
  106.                             case CLOSEWINDOW:
  107.                                 Flg_Exit=TRUE;
  108.                                 break;
  109.                             case MOUSEMOVE:
  110.                                 break;
  111.                         }
  112.                     }
  113.                 }
  114.     
  115.     
  116.                 FreeRaster(tmpras.RasPtr,WIDTH,HEIGHT);
  117.                 CloseWindow(win);
  118.             }
  119.             CloseScreen(s);
  120.         }
  121.         free(P_Tab_Drapeau);
  122.     }
  123. }
  124.